package com.example.mobifin_busticket;

import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;

import com.example.mobifin_busticket.controller.callbacks.ParseListner;
import com.example.mobifin_busticket.controller.networkmanager.NetworkManager;
import com.example.mobifin_busticket.models.BaseRequestEntityForBusTicketSeat;

public class AsyncTaskForSendJSONObj extends AsyncTask<String, String, Object> {
	Context mContext;
	private NetworkManager networkManager = NetworkManager.getInstance();
	private BaseRequestEntityForBusTicketSeat baseRequestEntityForBusTicket;
	ParseListner mListner;
	String strTag, pdMessage, strgetJSON;
	boolean isShowing = false;

	public AsyncTaskForSendJSONObj(Context mContext,
			BaseRequestEntityForBusTicketSeat baseRequestEntityForBusTicket,
			ParseListner mListner, String strJSON, String tag, String pdMessage) {
		this.baseRequestEntityForBusTicket = baseRequestEntityForBusTicket;
		this.mListner = mListner;
		this.mContext = mContext;
		this.strTag = tag;
		this.pdMessage = pdMessage;
		this.strgetJSON = strJSON;

	}

	/*@Override
	protected void onPreExecute() {
		super.onPreExecute();
		String[] pdTitleMsg, pdDestinationmsg;
		MyApplication.showProgressDialog(mContext, "Please wait..");
		if (!isShowing && !MyApplication.getPd().isShowing()) {
			if (pdMessage.contains("-")) {
				pdTitleMsg = pdMessage.split(",");
				pdDestinationmsg = pdTitleMsg[1].split("-");
				MyApplication.showProgressDialog(mContext, pdTitleMsg[0]);
			} else {
				pdTitleMsg = pdMessage.split(",");
			}
		}
	}*/

	protected Object doInBackground(String... params) {
		String httpresponse = "";
		httpresponse = networkManager.callSeatSeller(
				baseRequestEntityForBusTicket, strgetJSON);
		Log.d("jsonString", "" + httpresponse);
		return mListner.onParse(httpresponse);
	}
}
